<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<title>日报</title>
		<link rel="stylesheet"
			href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style type="text/css">
.ui-datatable-scrollable-header-box {
	margin-left: 0px;
	margin-right: 15px !important;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button"
				styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button"
				styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div id="headDiv" class="box box-solid with-border">
			<h:form id="headForm">
				<div class="box box-solid with-border">
					<div class="box-header" id="queryDiv">
						<p:outputLabel for="start" value="保护退出时间：" />
						<p:calendar id="start" navigator="true"
							value="#{protectDefectController.queryDate1}"
							pattern="yyyy-MM-dd" maxdate="Date()">
						</p:calendar>
						<p:outputLabel for="end" value="至 "
							style="margin-right:5px;margin-left:5px;" />
						<p:calendar id="end" navigator="true"
							value="#{protectDefectController.queryDate2}"
							pattern="yyyy-MM-dd" maxdate="Date()">
						</p:calendar>
						<p:commandButton value="查询" id="query1"
							update="form:dataTb toolbar" icon="ui-icon-search"
							actionListener="#{protectDefectController.queryByTime}"
							style="margin-left:5px;" oncomplete="getTableScrollHeight();">
						</p:commandButton>
						<p:commandButton icon="ui-icon-refresh" value="重置"
							actionListener="#{protectDefectController.resetQuery}"
							oncomplete="getTableScrollHeight();"
							update=" start end form:dataTb toolbar" style="margin-left:5px;" />
					</div>
				</div>
				<div id="toolbarDiv">
					<p:growl id="msgs" showDetail="true" />
					<p:toolbar id="toolbar">
						<f:facet name="left">
							<p:commandButton id="cgBtn1" value="新建" icon="ui-icon-document"
								update="createForm:createDetail form:dataTb"
								actionListener="#{protectDefectController.createProtectDefect}"
								oncomplete="PF('createDlgDefect').show();getTableScrollHeight();"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_bhqxjclqk_xj')}" />
							<p:commandButton update="editForm:editDetailDefect :form:dataTb"
								oncomplete="PF('editDlgDefect').show();getTableScrollHeight();"
								icon="ui-icon-pencil" value="编辑"
								disabled="#{protectDefectController.selectProtectDefect == null}"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_bhqxjclqk_bj')}">
							</p:commandButton>
							<p:commandButton value="删除" id="delbtn1" icon="ui-icon-trash"
								update="form:dataTb headForm:msgs toolbar"
								oncomplete="getTableScrollHeight();getTableScrollHeight();"
								actionListener="#{protectDefectController.deleteProtectDefect}"
								disabled="#{protectDefectController.selectProtectDefect == null}"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_bhqxjclqk_sc')}">
								<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</f:facet>
					</p:toolbar>
				</div>
			</h:form>
		</div>
		<div id="infoDiv" class="box box-solid with-border">
			<h:form id="form">
				<p:dataTable id="dataTb" var="item" scrollable="true"
					value="#{protectDefectController.defect}"
					selection="#{protectDefectController.selectProtectDefect}"
					rowKey="#{item.id}" rowIndexVar="ite" style="margin-bottom:0"
					emptyMessage="无记录" rows="10" paginator="true"
					paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="20,50,100" paginatorPosition="bottom">
					<f:facet name="{Customization}">
						<p:outputLabel
							value="总计：#{protectDefectController.defect.size()} 条记录"
							style="margin-right:20px;"></p:outputLabel>
					</f:facet>
					<p:ajax event="rowSelectRadio"
						listener="#{protectDefectController.defectRowSelect}"
						update="headForm:toolbar"></p:ajax>
					<p:column selectionMode="single" width="10"
						style="text-align:center" />
					<p:column width="10" headerText="序号 ">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column width="50" headerText="调管范围 ">
						<h:outputText value="#{item.subControlArea}" />
					</p:column>
					<p:column width="60" headerText="厂站名称">
						<h:outputText value="#{item.substationName}" />
					</p:column>
					<p:column width="60" headerText="设备名称">
						<h:outputText value="#{item.name}" />
					</p:column>
					<p:column width="60" headerText="保护型号">
						<h:outputText value="#{item.protectType}" />
					</p:column>
					<p:column width="60" headerText="保护退出时间">
						<h:outputText value="#{item.protectQuitTime}">
							<f:convertDateTime pattern="yyyy-MM-dd" />
						</h:outputText>
					</p:column>
					<p:column width="60" headerText="保护投入时间">
						<h:outputText value="#{item.protectInTime}">
							<f:convertDateTime pattern="yyyy-MM-dd" />
						</h:outputText>
					</p:column>
					<p:column width="120" headerText="缺陷描述">
						<h:outputText style="white-space:pre-wrap;"
							value="#{item.defectDescription}" />
					</p:column>
					<p:column width="100" headerText="检查及处理情况">
						<h:outputText escape="false"
							value="#{protectDefectController.replaceWithBr(item.linePatrolReasult)}" />
					</p:column>
				</p:dataTable>
			</h:form>
			<h:form id="createForm">
				<p:dialog widgetVar="createDlgDefect" header="新建" modal="true"
					id="createDlgDefect" width="800" height="400">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton id="createSaveBtn" value="保存"
								update="form:dataTb headForm:msgs" icon="ui-icon-disk"
								oncomplete="PF('createDlgDefect').hide();getTableScrollHeight()"
								actionListener="#{protectDefectController.saveNew}" />
						</f:facet>
					</p:toolbar>
					<p:outputPanel id="createDetail" style="width:100%;">
						<p:panelGrid style="width:100%;"
							rendered="#{not empty protectDefectController.created}">
							<p:row>
								<p:column>
									<h:outputText value="调管范围:" />
								</p:column>
								<p:column>
									<p:autoComplete forceSelection="true" size="16"
										scrollHeight="250" dropdown="true"
										value="#{protectDefectController.created.subControlArea}"
										completeMethod="#{substationCompelteController.completeSubControlArea}"
										required="true" requiredMessage="调管范围为必填项">
									</p:autoComplete>
								</p:column>
								<p:column>
									<h:outputText value="厂站名称:" />
								</p:column>
								<p:column>
									<p:autoComplete size="16" scrollHeight="250" dropdown="true"
										value="#{protectDefectController.created.substationName}"
										completeMethod="#{substationCompelteController.completeWorkplace}"
										required="true" requiredMessage="厂站名称为必填项">
									</p:autoComplete>
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="保护型号:" />
								</p:column>
								<p:column>
									<p:inputText label="protectType"
										value="#{protectDefectController.created.protectType}" />
								</p:column>
								<p:column>
									<h:outputText value="设备名称:" />
								</p:column>
								<p:column>
									<p:inputText label="protectType"
										value="#{protectDefectController.created.name}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="保护退出时间:" />
								</p:column>
								<p:column>
									<p:calendar
										value="#{protectDefectController.created.protectQuitTime}"
										navigator="true" pattern="yyyy-MM-dd" maxdate="Date()" />
								</p:column>
								<p:column>
									<h:outputText value="保护投入时间:" />
								</p:column>
								<p:column>
									<p:calendar
										value="#{protectDefectController.created.protectInTime}"
										navigator="true" pattern="yyyy-MM-dd" maxdate="Date()" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="缺陷描述:" />
								</p:column>
								<p:column colspan="3">
									<p:inputTextarea cols="2" style="width:100%;"
										autoResize="false"
										value="#{protectDefectController.created.defectDescription}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="检查及处理情况:" />
								</p:column>
								<p:column colspan="3">
									<p:inputTextarea rows="6" cols="4" style="width:100%;"
										autoResize="false"
										value="#{protectDefectController.created.linePatrolReasult}" />
								</p:column>
							</p:row>
						</p:panelGrid>
					</p:outputPanel>
				</p:dialog>
			</h:form>
			<h:form id="editForm">
				<p:dialog widgetVar="editDlgDefect" header="编辑" modal="true"
					id="editDlgDefect" width="800" height="400">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton value="保存" icon="ui-icon-disk"
								update="form:dataTb headForm:msgs"
								oncomplete="PF('editDlgDefect').hide();getTableScrollHeight()"
								actionListener="#{protectDefectController.update}" />
						</f:facet>
					</p:toolbar>
					<p:outputPanel id="editDetailDefect" style="width:100%;">
						<p:panelGrid style="width:100%;"
							rendered="#{not empty protectDefectController.selectProtectDefect}">
							<p:row>
								<p:column>
									<h:outputText value="调管范围:" />
								</p:column>
								<p:column>
									<p:autoComplete forceSelection="true" size="16"
										scrollHeight="250" dropdown="true"
										value="#{protectDefectController.selectProtectDefect.subControlArea}"
										completeMethod="#{substationCompelteController.completeSubControlArea}"
										required="true" requiredMessage="调管范围为必填项">
									</p:autoComplete>
								</p:column>
								<p:column>
									<h:outputText value="厂站名称:" />
								</p:column>
								<p:column>
									<p:autoComplete forceSelection="true" size="16"
										scrollHeight="250" dropdown="true"
										value="#{protectDefectController.selectProtectDefect.substationName}"
										completeMethod="#{substationCompelteController.completeWorkplace}"
										required="true" requiredMessage="厂站名称为必填项">
									</p:autoComplete>
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="保护型号:" />
								</p:column>
								<p:column>
									<p:inputText label="protectType"
										value="#{protectDefectController.selectProtectDefect.protectType}" />
								</p:column>
								<p:column>
									<h:outputText value="设备名称:" />
								</p:column>
								<p:column>
									<p:inputText label="protectType"
										value="#{protectDefectController.selectProtectDefect.name}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="保护退出时间:" />
								</p:column>
								<p:column>
									<p:calendar
										value="#{protectDefectController.selectProtectDefect.protectQuitTime}"
										navigator="true" pattern="yyyy-MM-dd" maxdate="Date()" />
								</p:column>
								<p:column>
									<h:outputText value="保护投入时间:" />
								</p:column>
								<p:column>
									<p:calendar
										value="#{protectDefectController.selectProtectDefect.protectInTime}"
										navigator="true" pattern="yyyy-MM-dd" maxdate="Date()" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="缺陷描述:" />
								</p:column>
								<p:column colspan="3">
									<p:inputTextarea cols="2" style="width:100%;"
										autoResize="false"
										value="#{protectDefectController.selectProtectDefect.defectDescription}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="检查及处理情况:" />
								</p:column>
								<p:column colspan="3">
									<p:inputTextarea cols="4" rows="6" style="width:100%;"
										autoResize="false"
										value="#{protectDefectController.selectProtectDefect.linePatrolReasult}" />
								</p:column>
							</p:row>
						</p:panelGrid>
					</p:outputPanel>
				</p:dialog>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="/resources/js/tables/singleScrollTable.js" />
	</ui:define>
</ui:composition>
